package com.ruoyi.system.service.life.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.system.domain.life.LifeFamilyFriends;
import com.ruoyi.system.service.life.ILifeFamilyFriendsService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.life.LifeFamilyFriendsMapper;

import static com.ruoyi.common.utils.SecurityUtils.getUsername;


/**
 * 亲戚朋友Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-22
 */
@Service
public class LifeFamilyFriendsServiceImpl implements ILifeFamilyFriendsService {
    @Resource
    private LifeFamilyFriendsMapper lifeFamilyFriendsMapper;

    /**
     * 查询亲戚朋友
     *
     * @param lUserId 亲戚朋友主键
     * @return 亲戚朋友
     */
    @Override
    public LifeFamilyFriends selectLifeFamilyFriendsByLUserId(String lUserId) {
        return lifeFamilyFriendsMapper.selectLifeFamilyFriendsByLUserId(lUserId);
    }

    /**
     * 查询亲戚朋友列表
     *
     * @param lifeFamilyFriends 亲戚朋友
     * @return 亲戚朋友
     */
    @Override
    public List<LifeFamilyFriends> selectLifeFamilyFriendsList(LifeFamilyFriends lifeFamilyFriends) {
        return lifeFamilyFriendsMapper.selectLifeFamilyFriendsList(lifeFamilyFriends);
    }

    /**
     * 新增亲戚朋友
     *
     * @param lifeFamilyFriends 亲戚朋友
     * @return 结果
     */
    @Override
    public int insertLifeFamilyFriends(LifeFamilyFriends lifeFamilyFriends) {
        lifeFamilyFriends.setCreateBy(getUsername());
        lifeFamilyFriends.setCreateTime(new Date());
        return lifeFamilyFriendsMapper.insertLifeFamilyFriends(lifeFamilyFriends);
    }

    /**
     * 修改亲戚朋友
     *
     * @param lifeFamilyFriends 亲戚朋友
     * @return 结果
     */
    @Override
    public int updateLifeFamilyFriends(LifeFamilyFriends lifeFamilyFriends) {
        lifeFamilyFriends.setUpdateBy(getUsername());
        lifeFamilyFriends.setUpdateTime(new Date());
        return lifeFamilyFriendsMapper.updateLifeFamilyFriends(lifeFamilyFriends);
    }

    /**
     * 批量删除亲戚朋友
     *
     * @param lUserIds 需要删除的亲戚朋友主键
     * @return 结果
     */
    @Override
    public int deleteLifeFamilyFriendsByLUserIds(String[] lUserIds) {
        return lifeFamilyFriendsMapper.deleteLifeFamilyFriendsByLUserIds(lUserIds);
    }

    /**
     * 删除亲戚朋友信息
     *
     * @param lUserId 亲戚朋友主键
     * @return 结果
     */
    @Override
    public int deleteLifeFamilyFriendsByLUserId(String lUserId) {
        return lifeFamilyFriendsMapper.deleteLifeFamilyFriendsByLUserId(lUserId);
    }
}
